<!DOCTYPE>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <title>钉铛加油</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <link href="../static/css/login.css" rel="stylesheet" />
    <style>
        .lmaisft{width:450px;border-radius:10px;text-align:left;background:white;border:1px #dddddd solid;}
        .box{box-shadow:0px 5px 15px 1px rgba(0,0,0,0.1);}
    </style>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body style="background:#E5F3FC;">
<div align="center" style="position:absolute;width:100%">
    <div id="topheih" class="blank40"></div>
    <div class="blank30"></div>
    <div class="lmaisft box">
        <div class="blank20"></div>
        <div  align="center"><img src="/static/images/logo.png" class="box" style="border:1px #ffffff solid; background:white" id="imglogo" align="absmiddle" height="100" width="100"><b style="font-size:22px"></b></div>
        <div class="blank10"></div>
        <form style="padding:20px;padding-left:80px" name="login" id="login" method="post" action="">
        <div>
            <div><input type="text" style="height:40px;width:300px" class="input" datatype="*" nullmsg="请输入用户名！" onKeyUp="if(event.keyCode==13)$('#password').focus()" placeholder="请输入用户名" id="usercode" name="usercode" ></div>
        </div>

        <div class="blank10"></div>
        <div>
            <div><input id="password" name="password" style="height:40px;width:300px" class="input"  onKeyUp="if(event.keyCode==13)$('#yz_check').focus()"  type="password" placeholder="请输入密码" datatype="*" nullmsg="请输入密码！"></div>
        </div>
        <div class="blank10"></div>
        <div>
            <div><input type="text" style="height:40px;width:300px" class="input" datatype="*" nullmsg="请输入验证码！" onKeyUp="if(event.keyCode==13)$('#login').submit()" placeholder="请输入验证码" name="yz_check" id="yz_check" ></div>
        </div>
        <div class="blank10"></div>
        <div align="left" style="width:300px">
            <div class="checkbox" style="float: left">
                <img id="valid_image" alt="看不清楚？点击换一张" title="看不清楚？点击换一张" src="" onclick="valid_code_refresh()"/>
            </div>
            <div class="checkbox" style="float: right"><label><input type="checkbox" id="ck_rmbUser" />记住密码</label>&nbsp; &nbsp; <font color="#888888"></font></div>
        </div>
        <div class="blank20"></div>
        <div align="left">
        <button type="button" style="padding:10px 20px" class="webbtn" name="button" onclick="loginClick()">登录</button>
        </div>
        <div class="blank10"></div>
        </form>
    </div>
    <div class="blank20"></div>
    <div align="center" style="height:30px;line-height:30px;color:#555555">
        dingdangkuaizu.com版权所有 ICP证:<a href="http://beian.miit.gov.cn/" target="_blank">鲁ICP备17042305号</a>
    </div>

</div>
<script type="text/javascript" src="../static/plug/jquery-2.1.0.js"></script>
<script type="text/javascript" >
    $(document).ready(function () {
        valid_code_refresh();
        if (localStorage.getItem("rmbUser") == "1") {
            $("#ck_rmbUser").attr("checked", true);
            $("#usercode").val(localStorage.getItem("usercode"));
            $("#password").val(localStorage.getItem("password"));
        }
        $("#usercode").focus();
        $("body").keydown(function() {
            if (event.keyCode == "13") {//keyCode=13是回车键
                $('.webbtn').click();
            }
        });
        $("#ck_rmbUser").click(function() {save();});
    });

    //用户登录
    function loginClick(){
       // var uname= $("#usercode").val();
       //  var pwd= $("#password").val();
       //  var ucode= $("#yz_check").val();
       //  $.ajax({
       //      async:false,
       //      type : 'post',
       //      url:"/loginAdmin",
       //      dataType:"json",
       //      data:{
       //          login_name :uname,
       //          password :pwd,
       //          verifyInput :ucode
       //      },
       //      success : function (result) {
       //          save();
       //          var result = JSON.stringify(result);
       //          var code = JSON.parse(result).data.code;
       //          var msg = JSON.parse(result).data.msg;
       //          if(code==0){
                    window.location.href="index";
       //          }else{
       //           alert(msg);
       //          }
       //
       //      }
       //  });

    }

    //验证表单
    function valid_code_refresh()
    {
        $("#valid_image").attr("src","/getCodeUser?dataTime="+new Date().getTime());
    }

    //记住用户名
    function save() {

        if ($("#ck_rmbUser").prop('checked')) {
            var str_username = $("#usercode").val();
            var str_password = $("#password").val();
            localStorage.setItem("usercode", str_username);
            localStorage.setItem("password", str_password);
            localStorage.setItem("rmbUser","1");
        }
        else {
            localStorage.removeItem("usercode");
            localStorage.removeItem("password");
            localStorage.removeItem("rmbUser");
        }
    }
</script>
</body>
<!-- END BODY -->
</html>